<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<form>
    <div>用户名：<input type="text" id="name"></div>
    <div>密码：<input type="password" id="password"></div>
    <input type="button" value="登录" id="login">
</form>


<script>
    $("#login").click(function () {
        var params = {
            name:$('#name').val(),
            password:$('#password').val()
        }
        getJqueryAjax('post',url,params,function (data) {
            if(data.code == '200'){
                console.log(data)
                alert('登录成功')
            }else{
                alert(data.msg)
            }

        })
    })

    var url = 'http://192.168.3.206:6000/login'
    function getJqueryAjax(type,url,params,success) {
        $.ajax({
            url:url,
            type:type,
            dataType:'json',
            data:params,
            beforeSend:function (xhr) {
               // console.log('start')
            },
            success:function (data) {
                success(data)
            },
            statusCode:{
                404:function(){
                    alert('404，页面不存在');
                }
            }
        })
    }
</script>
</body>
</html>